;*******************************************************************
;* Adjusting Probabilities according to mood
;*******************************************************************
[procedure-adjustProbabilities]
    procedure=pct90
    procedure=pct80
    procedure=pct70
    procedure=pct60
    procedure=pct50
    procedure=pct40
    procedure=pct30
    procedure=pct20
    procedure=pct10

[procedure-pct90]
    ;90 +/-20
    set#=#temp,#mood
    multiply#=#temp,4
    divide#=#temp,10
    add#=#temp,70
    set#=#pct90,#temp
    
[procedure-pct80]
    ;80 +/-20
    set#=#temp,#mood
    multiply#=#temp,4
    divide#=#temp,10
    add#=#temp,60
    set#=#pct80,#temp
    
[procedure-pct70]
    ;70 +/-25
    set#=#temp,#mood
    divide#=#temp,2
    add#=#temp,45
    set#=#pct70,#temp
    
[procedure-pct60]
    ;60 +/-25
    set#=#temp,#mood
    divide#=#temp,2
    add#=#temp,35
    set#=#pct60,#temp
    
[procedure-pct50]
    ;50 +/-25
    set#=#temp,#mood
    divide#=#temp,2
    add#=#temp,25
    set#=#pct50,#temp
    
[procedure-pct40]
    ;40 +/-20
    set#=#temp,#mood
    multiply#=#temp,4
    divide#=#temp,10
    add#=#temp,20
    set#=#pct40,#temp
    
[procedure-pct30]
    ;30 +/-20
    set#=#temp,#mood
    multiply#=#temp,4
    divide#=#temp,10
    add#=#temp,10
    set#=#pct30,#temp
    
[procedure-pct20]
    ;20 +/-20
    set#=#temp,#mood
    multiply#=#temp,4
    divide#=#temp,10
    set#=#pct20,#temp
    
[procedure-pct10]
    ;10 +/-10
    set#=#temp,#mood
    multiply#=#temp,2
    divide#=#temp,10
    set#=#pct10,#temp

;*******************************************************************
;* Book-keeping Procedures, and modifiers that add/remove merits per certain time
;*******************************************************************
[procedure-RefreshCore]
    ; load configureations
	procedure=init
    ; check bookkeeping flags for failsafe
    procedure=checkMPM
    procedure=checkMPH

[procedure-checkMPM]
    notIf=AddPerMin
    setFlag=AddPerMin
    
[procedure-checkMPH]
    notIf=AddPerHour
    setFlag=AddPerHour
    
[procedure-updateMPM]
    set#=#MPM,0
    add#=#MPM,#bathMPM
    

[procedure-AddPerMin]
    procedure=updateMPM
    addMerit=#MPM
	SetFlag=AddPerMin
    
[flag-AddPerMin]
	Duration=00:01
	ReportFlag=0
	ExpireProcedure=AddPerMin
    
[procedure-updateMPH]
    set#=#MPH,0
    set#=#temp,#clothingMPH
    multiply#=#temp,#clothingConsidered
    add#=#MPH,#temp
    set#=#temp,#bondageLevel
    multiply#=#temp,#bondageWorth
    multiply#=#temp,#bondageConsidered
    add#=#MPH,#temp
    

[procedure-AddPerHour]
    procedure=updateMPH
    addMerit=#MPH
	SetFlag=AddPerHour
    
[flag-AddPerHour]
	Duration=01:00
	ReportFlag=0
	ExpireProcedure=AddPerHour
    
[procedure-addShutdownMerits]
    notif=paused
    ; Lapse time:
    set!=!lapse,!zzOpenTime
    subtract!=!lapse,!zzCloseTime
    ; missing merits per minute
    procedure=updateMPM
    minutes#=#missing,!lapse
    multiply#=#missing,#MPM
    addMerit=#missing
    ; missing merits per hour
    procedure=updateMPH
    hours#=#missing,!lapse
    multiply#=#missing,#MPH
    addMerit=#missing
    